import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/HomePage',
      name: 'HomePage',
      component: () => import('../views/HomePage.vue'),
    },
    {
      path: '/home',
      name: 'home',
      component: HomeView,
    },
    {
      path: '/',
      name: 'login',
      component: () => import('../views/LoginView.vue'),
    },
    {
      path: '/Setup',
      name: 'Setup',
      component: () => import('../views/SetupView.vue'),
    },
    {
      path: '/about',
      name: 'about',
      component: () => import('../views/AboutView.vue'),
    },
    {
      path: '/Information',
      name: 'Information',
      component: () => import('../views/InformationView.vue'),
    },
    {
      path: '/Set',
      name: 'Set',
      component: () => import('../views/SetView.vue'),
    },
    {
      path: '/equipment',
      name: 'equipment',
      component: () => import('../views/EquipmentView.vue'),
    },
    {
      path: '/Outpatient',
      name: 'Outpatient',
      component: () => import('../views/OutpatientView.vue'),
    },
    {
      path: '/Healthy',
      name: 'Healthy',
      component: () => import('../views/HealthyView.vue'),
    },
    {
      path: '/Serve',
      name: 'Serve',
      component: () => import('../views/ServeView.vue'),
    },
    {
      path: '/me',
      name: 'me',
      component: () => import('../views/MeView.vue'),
    },
    {
      path: '/HomePage',
      name: 'HomePage',
      component: () => import('../views/HomePage.vue'),
    },
    {//消息中心
      path: '/messages',
      component: () => import('../views/MessageCenter.vue')
    },
    {//聊天列表
      path: '/Health',
      name: 'Health',
      component: () => import('../views/HealthView.vue')
    },
    {
      path: '/PatientInfo',
      name: 'PatientInfo',
      component: () => import('../views/PatientInfo.vue')
    },
    {
      path: '/DocumentDetail',
      name: 'DocumentDetail',
      component: () => import('../views/DocumentDetail.vue')
    },
    {
      path: '/ChatList',
      name: 'ChatList',
      component: () => import('../views/ChatList.vue')
    },
    {//聊天详情
      path: '/chat/:receiverId',
      name: 'ChatDetail',
      component: () => import('../views/ChatDetail.vue'),
      props: true
    },
    {
      path: '/BMI',
      component: () => import('../views/HealthMonitoring/BMI.vue')
    },
    {
      path: '/BloodPressure',
      component: () => import('../views/HealthMonitoring/BloodPressure.vue')
    },
    {
      path: '/BloodSugar',
      component: () => import('../views/HealthMonitoring/BloodSugar.vue')
    },
    {//健康方案
      path: '/healthplan',
      component: () => import('../views/healthplan.vue')
    },
     {//聊天---聊天
      path: '/LiaoTian',
      component: () => import('../views/LiaoTian.vue')
    },
    {//消息服务
      path: '/notifications',
      component: () => import('../views/notifications.vue')
    },
    {//消息服务--吃药提醒
      path: '/NotificationDetail',
      component: () => import('../views/NotificationDetail.vue')
    },
     {//消息服务--打卡提醒
      path: '/CheckinDetail',
      component: () => import('../views/CheckinDetail.vue')
    },
     {//消息服务--系统信息
      path: '/SystemMessages',
      component: () => import('../views/SystemMessages.vue')
    },
  ],
})



export default router;

// router.beforeEach((to, from, next) => {
//   if (to.path.toLocaleLowerCase() != "/"&&!window.localStorage.getItem("token")) {
//       next( {name: 'login'} )
//   } 
//   else{
//       next()
//   }
// })
// router.beforeEach((to, from, next) => {
//     if(to.name!='login'&&!window.localStorage.getItem("token")){
//         next({ name: 'login' })
//     }else{
//         next()
//     }
// })
